package api.app;

import java.io.IOException;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import common.Host;
import common.Request;

/**
 * 实现帮忙医APP提交意见反馈AddFeedback接口调用
 * 
 * @author lipeng
 *
 */
public class AddFeedback
{
	/**
	 * 实现帮忙医APP提交意见反馈AddFeedback接口调用
	 * 
	 * @param token
	 * @param attachPics--上传图片
	 * @param FeedbackBody--上传意见
	 * @return --接口返回数据
	 * @throws IOException
	 * @throws JSONException
	 */
	public static String post(String token, String[] picUrls, String FeedbackBody) throws IOException, JSONException
	{
		// 拼接口地址
		String url = Host.getAddress() + "/api/Feedback/AddFeedback";
		JSONArray AttPics = new JSONArray();
		if (picUrls != null)
		{
			for (String picUrl : picUrls)
			{
				AttPics.put(picUrl);
			}
		}

		// 给接口参数赋值
		JSONObject parms = new JSONObject();
		parms.put("AttachPics", AttPics);
		parms.put("FeedbackBody", FeedbackBody);

		// 调用接口并返回接口结果
		String result = Request.post(url, parms, token);
		return result;
	}
}
